package hu.gbalage.dml.parser.antlr.internal; 

import java.io.InputStream;
import org.eclipse.xtext.*;
import org.eclipse.xtext.parser.*;
import org.eclipse.xtext.parser.impl.*;
import org.eclipse.xtext.parsetree.*;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.xtext.parser.antlr.AbstractInternalAntlrParser;
import org.eclipse.xtext.parser.antlr.XtextTokenStream;
import org.eclipse.xtext.parser.antlr.XtextTokenStream.HiddenTokens;
import org.eclipse.xtext.parser.antlr.AntlrDatatypeRuleToken;
import org.eclipse.xtext.conversion.ValueConverterException;
import hu.gbalage.dml.services.DMLGrammarAccess;



import org.antlr.runtime.*;
import java.util.Stack;
import java.util.List;
import java.util.ArrayList;

public class InternalDMLParser extends AbstractInternalAntlrParser {
    public static final String[] tokenNames = new String[] {
        "<invalid>", "<EOR>", "<DOWN>", "<UP>", "RULE_STRING", "RULE_ID", "RULE_INT", "RULE_ML_COMMENT", "RULE_SL_COMMENT", "RULE_WS", "RULE_ANY_OTHER", "'document'", "'{'", "'}'"
    };
    public static final int RULE_ID=5;
    public static final int RULE_STRING=4;
    public static final int RULE_ANY_OTHER=10;
    public static final int RULE_INT=6;
    public static final int RULE_WS=9;
    public static final int RULE_SL_COMMENT=8;
    public static final int EOF=-1;
    public static final int RULE_ML_COMMENT=7;

        public InternalDMLParser(TokenStream input) {
            super(input);
        }
        

    public String[] getTokenNames() { return tokenNames; }
    public String getGrammarFileName() { return "../hu.gbalage.dml.language/src-gen/hu/gbalage/dml/parser/antlr/internal/InternalDML.g"; }


     
     	private DMLGrammarAccess grammarAccess;
     	
        public InternalDMLParser(TokenStream input, IAstFactory factory, DMLGrammarAccess grammarAccess) {
            this(input);
            this.factory = factory;
            registerRules(grammarAccess.getGrammar());
            this.grammarAccess = grammarAccess;
        }
        
        @Override
        protected InputStream getTokenFile() {
        	ClassLoader classLoader = getClass().getClassLoader();
        	return classLoader.getResourceAsStream("hu/gbalage/dml/parser/antlr/internal/InternalDML.tokens");
        }
        
        @Override
        protected String getFirstRuleName() {
        	return "Document";	
       	} 



    // $ANTLR start entryRuleDocument
    // ../hu.gbalage.dml.language/src-gen/hu/gbalage/dml/parser/antlr/internal/InternalDML.g:72:1: entryRuleDocument returns [EObject current=null] : iv_ruleDocument= ruleDocument EOF ;
    public final EObject entryRuleDocument() throws RecognitionException {
        EObject current = null;

        EObject iv_ruleDocument = null;


        try {
            // ../hu.gbalage.dml.language/src-gen/hu/gbalage/dml/parser/antlr/internal/InternalDML.g:72:50: (iv_ruleDocument= ruleDocument EOF )
            // ../hu.gbalage.dml.language/src-gen/hu/gbalage/dml/parser/antlr/internal/InternalDML.g:73:2: iv_ruleDocument= ruleDocument EOF
            {
             currentNode = createCompositeNode(grammarAccess.getDocumentRule(), currentNode); 
            pushFollow(FOLLOW_ruleDocument_in_entryRuleDocument73);
            iv_ruleDocument=ruleDocument();
            _fsp--;

             current =iv_ruleDocument; 
            match(input,EOF,FOLLOW_EOF_in_entryRuleDocument83); 

            }

        }
         
            catch (RecognitionException re) { 
                recover(input,re); 
                appendSkippedTokens();
            } 
        finally {
        }
        return current;
    }
    // $ANTLR end entryRuleDocument


    // $ANTLR start ruleDocument
    // ../hu.gbalage.dml.language/src-gen/hu/gbalage/dml/parser/antlr/internal/InternalDML.g:80:1: ruleDocument returns [EObject current=null] : ( 'document' '{' (lv_elements_2= ruleElement ) '}' ) ;
    public final EObject ruleDocument() throws RecognitionException {
        EObject current = null;

        EObject lv_elements_2 = null;


         EObject temp=null; setCurrentLookahead(); resetLookahead(); 
            
        try {
            // ../hu.gbalage.dml.language/src-gen/hu/gbalage/dml/parser/antlr/internal/InternalDML.g:85:6: ( ( 'document' '{' (lv_elements_2= ruleElement ) '}' ) )
            // ../hu.gbalage.dml.language/src-gen/hu/gbalage/dml/parser/antlr/internal/InternalDML.g:86:1: ( 'document' '{' (lv_elements_2= ruleElement ) '}' )
            {
            // ../hu.gbalage.dml.language/src-gen/hu/gbalage/dml/parser/antlr/internal/InternalDML.g:86:1: ( 'document' '{' (lv_elements_2= ruleElement ) '}' )
            // ../hu.gbalage.dml.language/src-gen/hu/gbalage/dml/parser/antlr/internal/InternalDML.g:86:2: 'document' '{' (lv_elements_2= ruleElement ) '}'
            {
            match(input,11,FOLLOW_11_in_ruleDocument117); 

                    createLeafNode(grammarAccess.getDocumentAccess().getDocumentKeyword_0(), null); 
                
            match(input,12,FOLLOW_12_in_ruleDocument126); 

                    createLeafNode(grammarAccess.getDocumentAccess().getLeftCurlyBracketKeyword_1(), null); 
                
            // ../hu.gbalage.dml.language/src-gen/hu/gbalage/dml/parser/antlr/internal/InternalDML.g:94:1: (lv_elements_2= ruleElement )
            // ../hu.gbalage.dml.language/src-gen/hu/gbalage/dml/parser/antlr/internal/InternalDML.g:97:6: lv_elements_2= ruleElement
            {
             
            	        currentNode=createCompositeNode(grammarAccess.getDocumentAccess().getElementsElementParserRuleCall_2_0(), currentNode); 
            	    
            pushFollow(FOLLOW_ruleElement_in_ruleDocument160);
            lv_elements_2=ruleElement();
            _fsp--;


            	        if (current==null) {
            	            current = factory.create(grammarAccess.getDocumentRule().getType().getClassifier());
            	            associateNodeWithAstElement(currentNode.getParent(), current);
            	        }
            	        
            	        try {
            	       		add(current, "elements", lv_elements_2, "Element", currentNode);
            	        } catch (ValueConverterException vce) {
            				handleValueConverterException(vce);
            	        }
            	        currentNode = currentNode.getParent();
            	    

            }

            match(input,13,FOLLOW_13_in_ruleDocument173); 

                    createLeafNode(grammarAccess.getDocumentAccess().getRightCurlyBracketKeyword_3(), null); 
                

            }


            }

             resetLookahead(); 
                	lastConsumedNode = currentNode;
                
        }
         
            catch (RecognitionException re) { 
                recover(input,re); 
                appendSkippedTokens();
            } 
        finally {
        }
        return current;
    }
    // $ANTLR end ruleDocument


    // $ANTLR start entryRuleElement
    // ../hu.gbalage.dml.language/src-gen/hu/gbalage/dml/parser/antlr/internal/InternalDML.g:126:1: entryRuleElement returns [EObject current=null] : iv_ruleElement= ruleElement EOF ;
    public final EObject entryRuleElement() throws RecognitionException {
        EObject current = null;

        EObject iv_ruleElement = null;


        try {
            // ../hu.gbalage.dml.language/src-gen/hu/gbalage/dml/parser/antlr/internal/InternalDML.g:126:49: (iv_ruleElement= ruleElement EOF )
            // ../hu.gbalage.dml.language/src-gen/hu/gbalage/dml/parser/antlr/internal/InternalDML.g:127:2: iv_ruleElement= ruleElement EOF
            {
             currentNode = createCompositeNode(grammarAccess.getElementRule(), currentNode); 
            pushFollow(FOLLOW_ruleElement_in_entryRuleElement206);
            iv_ruleElement=ruleElement();
            _fsp--;

             current =iv_ruleElement; 
            match(input,EOF,FOLLOW_EOF_in_entryRuleElement216); 

            }

        }
         
            catch (RecognitionException re) { 
                recover(input,re); 
                appendSkippedTokens();
            } 
        finally {
        }
        return current;
    }
    // $ANTLR end entryRuleElement


    // $ANTLR start ruleElement
    // ../hu.gbalage.dml.language/src-gen/hu/gbalage/dml/parser/antlr/internal/InternalDML.g:134:1: ruleElement returns [EObject current=null] : this_Chunk_0= ruleChunk ;
    public final EObject ruleElement() throws RecognitionException {
        EObject current = null;

        EObject this_Chunk_0 = null;


         EObject temp=null; setCurrentLookahead(); resetLookahead(); 
            
        try {
            // ../hu.gbalage.dml.language/src-gen/hu/gbalage/dml/parser/antlr/internal/InternalDML.g:139:6: (this_Chunk_0= ruleChunk )
            // ../hu.gbalage.dml.language/src-gen/hu/gbalage/dml/parser/antlr/internal/InternalDML.g:141:5: this_Chunk_0= ruleChunk
            {
             
                    currentNode=createCompositeNode(grammarAccess.getElementAccess().getChunkParserRuleCall(), currentNode); 
                
            pushFollow(FOLLOW_ruleChunk_in_ruleElement262);
            this_Chunk_0=ruleChunk();
            _fsp--;

             
                    current = this_Chunk_0; 
                    currentNode = currentNode.getParent();
                

            }

             resetLookahead(); 
                	lastConsumedNode = currentNode;
                
        }
         
            catch (RecognitionException re) { 
                recover(input,re); 
                appendSkippedTokens();
            } 
        finally {
        }
        return current;
    }
    // $ANTLR end ruleElement


    // $ANTLR start entryRuleChunk
    // ../hu.gbalage.dml.language/src-gen/hu/gbalage/dml/parser/antlr/internal/InternalDML.g:156:1: entryRuleChunk returns [EObject current=null] : iv_ruleChunk= ruleChunk EOF ;
    public final EObject entryRuleChunk() throws RecognitionException {
        EObject current = null;

        EObject iv_ruleChunk = null;


        try {
            // ../hu.gbalage.dml.language/src-gen/hu/gbalage/dml/parser/antlr/internal/InternalDML.g:156:47: (iv_ruleChunk= ruleChunk EOF )
            // ../hu.gbalage.dml.language/src-gen/hu/gbalage/dml/parser/antlr/internal/InternalDML.g:157:2: iv_ruleChunk= ruleChunk EOF
            {
             currentNode = createCompositeNode(grammarAccess.getChunkRule(), currentNode); 
            pushFollow(FOLLOW_ruleChunk_in_entryRuleChunk293);
            iv_ruleChunk=ruleChunk();
            _fsp--;

             current =iv_ruleChunk; 
            match(input,EOF,FOLLOW_EOF_in_entryRuleChunk303); 

            }

        }
         
            catch (RecognitionException re) { 
                recover(input,re); 
                appendSkippedTokens();
            } 
        finally {
        }
        return current;
    }
    // $ANTLR end entryRuleChunk


    // $ANTLR start ruleChunk
    // ../hu.gbalage.dml.language/src-gen/hu/gbalage/dml/parser/antlr/internal/InternalDML.g:164:1: ruleChunk returns [EObject current=null] : (lv_text_0= RULE_STRING ) ;
    public final EObject ruleChunk() throws RecognitionException {
        EObject current = null;

        Token lv_text_0=null;

         EObject temp=null; setCurrentLookahead(); resetLookahead(); 
            
        try {
            // ../hu.gbalage.dml.language/src-gen/hu/gbalage/dml/parser/antlr/internal/InternalDML.g:169:6: ( (lv_text_0= RULE_STRING ) )
            // ../hu.gbalage.dml.language/src-gen/hu/gbalage/dml/parser/antlr/internal/InternalDML.g:170:1: (lv_text_0= RULE_STRING )
            {
            // ../hu.gbalage.dml.language/src-gen/hu/gbalage/dml/parser/antlr/internal/InternalDML.g:170:1: (lv_text_0= RULE_STRING )
            // ../hu.gbalage.dml.language/src-gen/hu/gbalage/dml/parser/antlr/internal/InternalDML.g:172:6: lv_text_0= RULE_STRING
            {
            lv_text_0=(Token)input.LT(1);
            match(input,RULE_STRING,FOLLOW_RULE_STRING_in_ruleChunk349); 

            		createLeafNode(grammarAccess.getChunkAccess().getTextSTRINGTerminalRuleCall_0(), "text"); 
            	

            	        if (current==null) {
            	            current = factory.create(grammarAccess.getChunkRule().getType().getClassifier());
            	            associateNodeWithAstElement(currentNode, current);
            	        }
            	        
            	        try {
            	       		set(current, "text", lv_text_0, "STRING", lastConsumedNode);
            	        } catch (ValueConverterException vce) {
            				handleValueConverterException(vce);
            	        }
            	    

            }


            }

             resetLookahead(); 
                	lastConsumedNode = currentNode;
                
        }
         
            catch (RecognitionException re) { 
                recover(input,re); 
                appendSkippedTokens();
            } 
        finally {
        }
        return current;
    }
    // $ANTLR end ruleChunk


 

    public static final BitSet FOLLOW_ruleDocument_in_entryRuleDocument73 = new BitSet(new long[]{0x0000000000000000L});
    public static final BitSet FOLLOW_EOF_in_entryRuleDocument83 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_11_in_ruleDocument117 = new BitSet(new long[]{0x0000000000001000L});
    public static final BitSet FOLLOW_12_in_ruleDocument126 = new BitSet(new long[]{0x0000000000000010L});
    public static final BitSet FOLLOW_ruleElement_in_ruleDocument160 = new BitSet(new long[]{0x0000000000002000L});
    public static final BitSet FOLLOW_13_in_ruleDocument173 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_ruleElement_in_entryRuleElement206 = new BitSet(new long[]{0x0000000000000000L});
    public static final BitSet FOLLOW_EOF_in_entryRuleElement216 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_ruleChunk_in_ruleElement262 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_ruleChunk_in_entryRuleChunk293 = new BitSet(new long[]{0x0000000000000000L});
    public static final BitSet FOLLOW_EOF_in_entryRuleChunk303 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_RULE_STRING_in_ruleChunk349 = new BitSet(new long[]{0x0000000000000002L});

}